<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="B2B电商平台" name="description" />
<meta content="B2B电商平台" name="keyword" />

<title>B2B电商平台.促销活动统计</title>
<link rel="icon" href="include/images/icss.ico" type="image/x-icon" />
<link rel="shortcut icon" href="include/images/icss.ico"
	type="image/x-icon" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/include/css/global.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/include/css/style.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/include/css/pro.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/include/css/proManage.css" />
<link rel="stylesheet"
	href="<%=path%>/include/JQuery ui/css/smoothness/jquery-ui-1.7.3.custom.css"
	type="text/css"></link>
<link rel="stylesheet" type="text/css"
	href="<%=path%>/include/pagination/page.css" media="all">
<link rel="stylesheet" type="text/css"
	href="<%=path%>/include/css/mmt_trading.css" />
<script type="text/javascript"
	src="<%=path%>/include/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<%=path%>/include/js/cookies.js"></script>
<script type="text/javascript" src="<%=path%>/include/js/icss.busin.js"></script>
<script type="text/javascript"
	src="<%=path%>/include/JQuery ui/js/jquery-ui-1.7.3.custom.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/include/js/icss.common.js"></script>
<script type="text/javascript"
	src="<%=path%>/include/pagination/jquery.pagination.js"></script>
<script type="text/javascript"
	src="<%=path%>/include/pagination/init.js"></script>
<script src="<%=path%>/include/DatePicker/WdatePicker.js"
	charset="UTF-8" type="text/javascript"></script>
<style type="text/css">
.price a.price_rise {
	background-position: -62px -136px;
}

.price a.price_drop {
	background-position: -62px -95px;
}

.price a.price_null {
	background-position: -1px -280px;
	padding-right: 0px;
}

.expire a.expire_drops {
	background-position: -61px -95px;
}

.expire a.expire_rise {
	background-position: -61px -136px;
}

.expire a.expire_null {
	background-position: -61px -15px;
	padding-right: 0px;
}
#listTable th {
	line-height: 30px;
	border: 1px solid #ddd;
	font-weight: bold;
}

#ajaxSerieslist td {
	border: 1px solid #ddd;
	line-height: 40px;
}
.search_lis_se input{
height: 24px;
}
</style>

<script type="text/javascript">
$(document).ready(function() {
	_reHeight("rightFrame","contentDiv");

	_queryList();
	
});

	function shouDialog(){
		$("#dialogDiv").dialog("open");
	}

	//处理查询条件的默认值
    //参数：id;ovalue原值;nvalue 新值; type：事件类型（1表示获取焦点 2表示失去焦点）
    function clearDefaultVal(id,type,ovalue,nvalue){
        if(type==1){//判断事件类型(获取焦点,情况现有默认值)
            jQuery("#"+id).val("");
        }else{
            //失去焦点，值为空，赋默认值
            if(nvalue==""){
                jQuery("#"+id).val(ovalue);
            }
        }
    }

    
    var pagination;
    
	function _queryList(){
		var title = $("#queryTitle").val();
		if(title =="请输入活动名称..."){
			title = "";
		}
		var date =  $("#useDate").val();
		
		var url = "<%=path%>/promotionStatistics/promotionList.do?name="+title+"&date="+date;
  			pagination = _initPagination({'pageId':'pagination', 'cKey':'toPromotionList','url': url, 'rows': 10, 'callback':_initDataList});
  		
	}
	function _initDataList(data) {
	 		var d = data.rows;
	 		var total = data.total;
			var str = "";
			$("#ajaxSerieslist").empty();
			for(var i=0;i<d.length;i++){
				
				str += "<tr>";
				str += "    <td class='t2' style='text-align:left;vertical-align: middle'>";
				str += "      <span style='padding-left: 10px;'>"+d[i].PROMOTION_NAME+"</span>";
				str += "	</td>";
				str +="		<td class='t3' id='pubdateTd'  style='text-align:center;vertical-align: middle'>";
				str +=" 				<span style='color: #000000'>"+d[i].BEG_TIME+"</span>";
				str +=" 	</td>";
				str +="		<td class='t3' id='pubdateTd'  style='text-align:center;vertical-align: middle'>";
				str +=" 		<span  style='color: #000000'>"+d[i].END_TIME+"</span>";
				str +=" 	</td>";
				str +="		<td class='t1' id='pubdateTd'  style='text-align:center;vertical-align: middle'>";
				str +=" 		<span>"+d[i].PROMOTION_RANGE+"</span>";
				str +=" 	</td>";
				str +="		<td class='t4' id='pubdateTd'  style='text-align:center;vertical-align: middle'>";
				if(d[i].PROM_TYPE == '1'){
					str += " 		<span>" + d[i].PROMOTION_TYPE + "(" + d[i].PROMOTION_NUM + "折)</span>";
				}else if(d[i].PROM_TYPE == '2'){
					str += " 		<span>" + d[i].PROMOTION_TYPE + "(" + d[i].PROMOTION_NUM + "元)</span>";
				}
				str +=" 	</td>";	
				str +="		<td class='t1' id='pubdateTd'  style='text-align:center;vertical-align: middle'>";
				str +=" 		<span>"+d[i].STATUS+"</span>";
				str +=" 	</td>";
				str +="		<td class='t1' id='pubdateTd'  style='text-align:right;vertical-align: middle'>";
				str +=" 		<span>"+d[i].SALE_AMOUNT+"&nbsp;</span>";
				str +=" 	</td>";
				str +="		<td class='t1' id='pubdateTd'  style='text-align:right;vertical-align: middle'>";
				str +=" 		<span>"+d[i].REDUCE_MONEY+"&nbsp;</span>";
				str +=" 	</td>";
				str +=" 	<td  style='text-align:center;vertical-align: middle'>";
				str +="    		<p><a  href='javascript:_detail(\""+ d[i].PROMOTION_ID +"\",\""+ d[i].SHOP_ID +"\");'>明细</a>";
				str +=" 		</p>";
				str +=" 	</td>";              
				str +=" </tr>";
			}
			$("#ajaxSerieslist").append(str);
			
	 }
	
	function _detail(promotion_Id,shop_Id){
		var url ="<%=path%>/promotionStatistics/detailPage.do?promotion_Id="
				+ promotion_Id;
		window.location = url;
	}
</script>
</head>

<body style="font-family: '微软雅黑';">
	<div id="contentDiv" style="padding:4px; width:99%;">
		<div class="colnums-2-ab-b">
			<div class="toptil">限时促销活动统计</div>
			<div class="search_lis"
				style="border: 1px solid #e0e0e0;background: #f5f5f5;padding-left:5px;margin-bottom:10px;width:99%;">
				<!--search_lis S-->
				<div class="search_lis_se"
					style="width:90%;font-size: 14px;line-height: 26px;">
					<!--search_lis_se S-->
					<span>活动名称:</span> <input name="querytitle" id="queryTitle"
						type="text" class="in_bit" maxlength="40" style="color:black;" > <span>活动时间:</span>
					<input type="text" id="useDate" name="useDate" 
						onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
						style="width:160px;height: 24px; padding-left: 3px"
						onfocus="WdatePicker({position:{left:318,top:89}})" class="Wdate"
						value="" /> &nbsp;&nbsp;
					<button type="button" class="cxx_btn" onclick="_queryList()">查询</button>
				</div>
			</div><div class="row-fluid dataTables_wrapper" style="width:100%;">
				<table id="listTable"
					class="table table-hover table-nomargin table-bordered usertable dataTable"
					style="width: 100%; border-spacing: 0;">
					<thead>
						<tr class="trBgd"
							style="background-color: #eee;text-align: center; height: 31px; border: 1px solid #ddd; white-space: nowrap; background-position: 0 -123px; line-height: 30px; font-weight: bold;">
							<th class="t2" style="text-align:center;vertical-align: middle">活动名称</th>
							<th class="t3" style="text-align:center;vertical-align: middle">开始时间</th>
							<th class="t3" style="text-align:center;vertical-align: middle">结束时间</th>
							<th class="t1" style="text-align:center;vertical-align: middle">范围</th>
							<th class="t4" style="text-align:center;vertical-align: middle">类型</th>
							<th class="t1" style="text-align:center;vertical-align: middle">状态</th>
							<th class="t1" style="text-align:center;vertical-align: middle">促销数量</th>
							<th class="t1" style="text-align:center;vertical-align: middle">减免金额</th>
							<th class="t5" style="text-align:center;vertical-align: middle">操作</th>
						</tr>
					</thead>
					<tbody id="ajaxSerieslist">
					</tbody>
				</table>
				<div id="pagination"></div>
			</div>
		</div>
	</div>

</body>
</html>
